package com.qdlc.p2p.manage.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.ScoreLotteryRecordService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.common.util.StringUtil;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.ScoreLotteryRecordModel;

/**
 * 积分抽奖记录管理
 * @author xxx
 * @version 2.0
 * @date 2015年6月16日 下午9:22:08
 */
public class ManageScoreLotteryRecordAction extends BaseAction<ScoreLotteryRecordModel> implements ModelDriven<ScoreLotteryRecordModel> {

	@Resource
	private ScoreLotteryRecordService scoreLotteryRecordService;

	private Map<String, Object> data;

	/**
	 * 积分抽奖记录管理
	 * @return
	 * @throws Exception
	 */
	@Action(value = "/modules/user/score/lotteryRecord/manage")
	public String manage() throws Exception {
		return "manage";
	}

	/**
	 * 积分抽奖列表
	 * @return
	 * @throws Exception
	 */
	@Action(value = "/modules/user/score/lotteryRecord/list")
	public void scoreLotteryRecordList() throws Exception {
		if (StringUtil.isBlank(paramString("type"))) {
			model.setType(99);
		}
		PageDataList<ScoreLotteryRecordModel> page = scoreLotteryRecordService.findPageList(model);
		data = new HashMap<String, Object>();
		data.put("total", page.getPage().getTotal());
		data.put("rows", page.getList());
		printJson(getStringOfJpaObj(data));
	}
	
}
